import React from "react"
import { List, Typography, Radio, RadioChangeEvent } from "antd"
import prices from "../../../utils/price"

const { Title } = Typography

const Radiobox = ({ handleFilter }: { handleFilter(filters: number[]): void }) => {

    const onchange = (e: RadioChangeEvent) => {
        handleFilter(e.target.value)
    }
    return (
        <>
            <Title level={4}>按照价格筛选</Title>
            <Radio.Group onChange={onchange}>
                <List dataSource={prices}
                    renderItem={
                        item => (
                            <List.Item>
                                <Radio value={item.array}>{item.name}</Radio>
                            </List.Item>
                        )
                    }></List>
            </Radio.Group>
        </>
    )
}

export default Radiobox
